FUNCTION DAC_GetBitOfByte :BOOL
TITLE = 'DAC_GetBitOfByte'
//
// This functionblock extract a single bit of a byte
// 
// Versionshistory:
// 1.0 Ersterstellung E.Dittmann

VERSION : '1.0'
AUTHOR  : 'Lenze'
FAMILY  : 'DAC'
NAME : 'xofby'
KNOW_HOW_PROTECT

VAR_INPUT
    byInput:                    BYTE;                               // Inputbyte
    byBitNr:                    BYTE;                               // Bitnumber (Range 0 - 7)
END_VAR

VAR
END_VAR

BEGIN
DAC_GetBitOfByte := false;
IF (BYTE_TO_INT(byBitNr) >= 0) AND (BYTE_TO_INT(byBitNr) <8) THEN
    DAC_GetBitOfByte :=Byte_TO_INT((SHR(IN:=byInput,N:=BYTE_TO_INT(byBitNr)) AND 16#0001)) > 0;
END_IF;

END_FUNCTION